*** sequence/sequence.c.orig	27 Sep 2006 14:56:17 -0000	12.39
--- sequence/sequence.c	26 Oct 2006 07:36:05 -0000
***************
*** 228,233 ****
--- 228,236 ----
  	seq->seq_data.ulen = seq->seq_data.size = sizeof(seq->seq_record);
  	seq->seq_rp = &seq->seq_record;
  
+ 	if ((ret = __dbt_usercopy(dbenv, keyp)) != 0)
+ 		goto err;
+ 
  	memset(&seq->seq_key, 0, sizeof(DBT));
  	if ((ret = __os_malloc(dbenv, keyp->size, &seq->seq_key.data)) != 0)
  		goto err;
***************
*** 365,370 ****
--- 368,374 ----
  		ret = t_ret;
  
  	ENV_LEAVE(dbenv, ip);
+ 	__dbt_userfree(dbenv, keyp, NULL, NULL);
  	return (ret);
  }
  
***************
*** 764,769 ****
--- 768,777 ----
  	DBT *key;
  {
  	SEQ_ILLEGAL_BEFORE_OPEN(seq, "DB_SEQUENCE->get_key");
+ 
+ 	if (F_ISSET(key, DB_DBT_USERCOPY))
+ 		return (__db_retcopy(seq->seq_dbp->dbenv, key,
+ 		    seq->seq_key.data, seq->seq_key.size, NULL, 0));
  
  	key->data = seq->seq_key.data;
  	key->size = key->ulen = seq->seq_key.size;
